<?php 
$link = mysqli_connect("localhost","root","root","2113");
$id=$_POST['id'];
$val = $_POST['val'];
$sql="UPDATE carts SET num=$val WHERE id=$id";
$res =  mysqli_query($link,$sql);
if($res){
	$arr['status'] = 1;
	$arr['info'] = "减少成功";
}else{
	$arr['status'] = 0;
	$arr['info'] = "减少失败";
}
echo json_encode($arr);
?>